package com.zw.mes.module.prdctionFlow.controller;

import com.zw.mes.base.BaseController;
import com.zw.mes.common.JsonResult;
import com.zw.mes.module.prdctionFlow.model.HistAppiyModel;
import com.zw.mes.module.prdctionFlow.service.HistAppiyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @Description: 计划确认接口
 * @Author: China.sgl
 * @Date: 2020/8/3 16:11
 */
@Controller
@RequestMapping("hist/Transposition")
@SuppressWarnings("all")
public class HistAppiyController extends BaseController {

    @Autowired
    private HistAppiyService histAppiyService;

    /**
     * 历史申请跳转
     * @param model
     * @return
     */
    @GetMapping
    public String TranspositionHist(Model model){
        return "prdctionFlow/histApply/page";
    }


    /**
     * 历史申请列表
     */
    @ResponseBody
    @PostMapping("/histList")
    public JsonResult histList(HistAppiyModel histAppiyModel){
        startPage();
        List<HistAppiyModel> list = histAppiyService.findHistList(histAppiyModel);
        return jsonResult(list);
    }

    /**
     * 撤销
     */
    @PostMapping("/revokeUpdate")
    @ResponseBody
    public JsonResult revokeUpdate(Integer id){
        return isNotNull(histAppiyService.updateFlowCheck(id));
    }

}
